package com.lrs.java.j2se_self.gui;
import java.awt.*;
import java.awt.event.*;
public class TestTextField {
	public static void main(String[] args){
		TFrame tt = new TFrame();
	}
}
class TFrame extends Frame {
	TFrame (){
		TextField tf = new TextField("TextField",20);
		add(tf,BorderLayout.CENTER);
		Monitor2 m2 = new Monitor2();
		tf.addActionListener(m2);
		pack();
		setVisible(true);
	}
}
class Monitor2 implements ActionListener {
	public void actionPerformed(ActionEvent e){
		TextField tf = (TextField)e.getSource();
		System.out.println(tf.getText());
		tf.setText("");
	}
}